<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form id="pagerForm" method="get" model="viewRequest" action="#rel#">
	<input type="hidden" name="viewRequest.page" value="${page.number}" />
	<input type="hidden" name="viewRequest.size" value="${page.size}" />
	<c:forEach items="${viewRequest.params}" var="params">
		<input type="hidden" id="${params.key}" name="viewRequest.params['${params.key}']" value="${params.value}" />
	</c:forEach>
	<c:forEach items="${viewRequest.sort}" var="sort">
		<input type="hidden" name="viewRequest.sort.${sort.key}" value="${sort.value}" />
	</c:forEach>
	
	
	<input type="hidden" name="userName" value="${userName}" />
	<input type="hidden" name="member.name" value="${member.name}" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return orders_navSearch(this);" action="${rootUrl}/order/sales-return" method="get">
	<div class="searchBar">
		<ul class="searchContent" style="height: 60px">
			<li>
				<label>订单编号：</label>
				<input type="text" name="viewRequest.params['s_dot_orderCode_like']" value="${viewRequest.params.s_dot_orderCode_like}"/>
			</li>
			<li style="width: 500px">
				<label>下单时间：</label>
				<input name="viewRequest.params['_and_s_dot_order_dot_createdAt_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_order_dot_createdAt_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_s_dot_order_dot_createdAt_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_order_dot_createdAt_le_date'] }" placeholder="结束时间"/>
			</li>
			<li style="width: 500px">
				<label>申请时间：</label>
				<input name="viewRequest.params['_and_s_dot_createdAt_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_createdAt_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_s_dot_createdAt_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_createdAt_le_date'] }" placeholder="结束时间"/>
			</li>
			<li style="width: 500px">
				<label>退款时间：</label>
				<input name="viewRequest.params['_and_s_dot_refundTime_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_refundTime_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_s_dot_refundTime_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_refundTime_le_date'] }" placeholder="结束时间"/>
			</li>
			<li>
				<label>下单用户：</label>
				<input type="hidden" id="memberId_sl" name="member.id" value="${viewRequest.params._and_s_dot_member_dot_id_eq_string}"/>
				<input type="text" id="memberName_sl" name="member.name" style="float:left" value="${member.name}"/>
				<a class="btnLook" href="${rootUrl}/member/member/1/dialog" width="800" height="720" lookupGroup="member">会员</a>
			</li>
			<li>
				<label>退款类型：</label>
				<select name="viewRequest.params['_and_s_dot_type_eq_string']">
					<option value="" <c:if test="${viewRequest.params._and_s_dot_type_eq_string == ''}">selected="selected"</c:if>>全部</option>
					<option value="1" <c:if test="${viewRequest.params._and_s_dot_type_eq_string == '1'}">selected="selected"</c:if>>退货退款</option>
					<option value="2" <c:if test="${viewRequest.params._and_s_dot_type_eq_string == '2'}">selected="selected"</c:if>>仅退款</option>
				</select>
			</li>
			<li style="width: 500px">
				<label>处理人：</label>
				<input type="hidden" id="userId_sr" name="user.id" value="${viewRequest.params._and_s_dot_userId_like}"/>
				<input type="text" name="user.name" id="userName_sr" style="float:left" value="${userName}"/>
				<a class="btnLook" href="${rootUrl}/system/user/1/dialog" width="800" height="720" lookupGroup="user">会员</a>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<table class="table" targetType="navTab"  width="100%" layoutH="145">
		<thead>
			<tr>
				<th width="30" align="center" >序号</th>
				<th width="100">订单编号</th>
				<th width="100">买家</th>
				<th width="120">支付时间</th>
				<th width="120">申请退款时间</th>
				<th width="100">实际退款时间</th>
				<th width="50">商品金额</th>
				<th width="50">优惠金额</th>
				<th width="50">订单金额</th>
				<th width="50">运费金额</th>
				<th width="50">应付金额</th>
				<th width="50">申请退款额</th>
				<th width="50">实际退款额</th>
				<th width="60">退款类型</th>
				<th width="60">退款状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.content}" var="sales_return" varStatus="status">
			<tr target="data_id" rel="${orders.id}">
				<td>${status.count}</td>
				<td>${sales_return.orderCode}</td>
				<td>${sales_return.member.name}</td>
				<td><fmt:formatDate value="${sales_return.order.payTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${sales_return.createdAt}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${sales_return.refundTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td class="listMoneyField"<fmt:formatNumber value="${sales_return.order.goodsAmount/100}" pattern="0.00"/>></td>
				<td class="listMoneyField"><fmt:formatNumber value="${sales_return.order.discountAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${sales_return.order.orderAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${sales_return.order.freightAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${sales_return.order.resultAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${sales_return.applyAmount/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${sales_return.refundAmount/100}" pattern="0.00"/></td>
				<td><c:if test="${sales_return.type == '1'}">退货退款</c:if><c:if test="${sales_return.type == '2'}">仅退款</c:if></td>
				<td><c:if test="${sales_return.state == '0'}">待审核</c:if><c:if test="${sales_return.state == '1'}">审核通过</c:if><c:if test="${sales_return.state == '2'}">审核不通过</c:if><c:if test="${sales_return.state ==3 }">退货成功</c:if><c:if test="${sales_return.state ==4 }">退货失败</c:if></td>
				<td>
				    <a title="浏览" target="dialog"  max="true" rel="sales_return_detail" title="浏览"  href="${rootUrl}/order/sales-return/${sales_return.id}/edit" class="btnView">浏览</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="${page.size}">${page.size}</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共${page.totalElements}条 </span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="${page.totalElements}" numPerPage="${page.size}" pageNumShown="10" currentPage="${page.number}"></div>
	</div>
</div>
<script>
	function orders_navSearch(obj){
		$("#memberId_sl").attr("name","viewRequest.params['_and_s_dot_member_dot_id_eq_string']");
		$("#userId_sr").attr("name","viewRequest.params['_and_s_dot_userId_like']");
		$("#userName_sr").attr("name","userName");
		
		if($("#memberName_sl").val() == ""){
			$("#memberId_sl").val("");
		}
		if($("#userName_sr").val() == ""){
			$("#userId_sr").val("");
		}
		return navTabSearch(obj);
	}
</script>